package com.mercenary.wein.screenControl.ui.batch;

import com.mercenary.wein.screenControl.command.CommandTool;
import com.mercenary.wein.screenControl.ui.GroupComboBox;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;

import javax.swing.BorderFactory;
import javax.swing.ComboBoxEditor;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.Border;

public class AcceptFriendRequest extends JDialog implements ActionListener, ItemListener {

    GroupCheckBoxPanel RequestJ1 = new GroupCheckBoxPanel();//面板1
    JPanel RequestJ2 = new JPanel();//面板2
    JPanel RequestJ3 = new JPanel();//面板2上的主操作面板
    JPanel LocationJ6 = new JPanel();
    JButton j1 = new JButton("一键接受");
    static JFrame locationjf = new JFrame();

    public AcceptFriendRequest() {
        super(locationjf, "接受好友请求");
        setBounds(200, 100, 700, 550);
        setLayout(new BorderLayout());
        setVisible(true);
        add(RequestJ1, BorderLayout.WEST);
        add(RequestJ2, BorderLayout.EAST);
        RequestJ1.setPreferredSize(new Dimension(180, 550));//设置大小
        RequestJ1.setBackground(Color.WHITE);
        RequestJ2.setPreferredSize(new Dimension(500, 550));
        RequestJ2.setBackground(Color.WHITE);
        RequestJ2.add(j1);
        Border titleBorder1 = BorderFactory.createTitledBorder("请选择在线设备");// 设置面板边框，实现分组框的效果       .设置面板边框颜色
        RequestJ1.setBorder(titleBorder1);


        //J2中的组件
        //一键接受好友请求按钮
        j1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                CommandTool.acceptAddRequest(RequestJ1.getSelectedDevices());
            }
        });
    }

    public void itemStateChanged(ItemEvent e) {
        // TODO Auto-generated method stub

    }

    public void actionPerformed(ActionEvent e) {
        // TODO Auto-generated method stub

    }

    public static void main(String[] arge) {
        new AcceptFriendRequest();


    }

}
